<<<<<<< HEAD
<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2021/1/11
  Time: 10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
pageContext.setAttribute("name1","天河1");//只在页面中有效
request.setAttribute("name2","天河2");//保存得数据只在请求中有效，请求转发会携带这个数据
session.setAttribute("name3","天河3");//保存数据只在会话中有效，从打开浏览器到关闭浏览器
application.setAttribute("name4","天河4");//保存得数据只在服务器中有效，从打开服务求到关闭服务器
%>
<%
    String name1 = (String) pageContext.getAttribute("name1");
    String name2 = (String) pageContext.getAttribute("name2");
    String name3 = (String) pageContext.getAttribute("name3");
    String name4 = (String) pageContext.getAttribute("name4");
    String name5 = (String) pageContext.getAttribute("name4");
%>
<h3>${name1}</h3>
<h3>${name2}</h3>
<h3>${name3}</h3>
<h3>${name4}</h3>
<%--<h3>${name5}</h3>--%>
<h3><%=name5%></h3>

<%pageContext.forward("PageContextDemo02.jsp");%>


</body>
</html>
=======
<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2021/1/11
  Time: 10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
pageContext.setAttribute("name1","天河1");//只在页面中有效
request.setAttribute("name2","天河2");//保存得数据只在请求中有效，请求转发会携带这个数据
session.setAttribute("name3","天河3");//保存数据只在会话中有效，从打开浏览器到关闭浏览器
application.setAttribute("name4","天河4");//保存得数据只在服务器中有效，从打开服务求到关闭服务器
%>
<%
    String name1 = (String) pageContext.getAttribute("name1");
    String name2 = (String) pageContext.getAttribute("name2");
    String name3 = (String) pageContext.getAttribute("name3");
    String name4 = (String) pageContext.getAttribute("name4");
    String name5 = (String) pageContext.getAttribute("name4");
%>
<h3>${name1}</h3>
<h3>${name2}</h3>
<h3>${name3}</h3>
<h3>${name4}</h3>
<%--<h3>${name5}</h3>--%>
<h3><%=name5%></h3>

<%pageContext.forward("PageContextDemo02.jsp");%>


</body>
</html>
>>>>>>> 0955e43271ec003176a75da3f24c6d9c0071fe9b
